<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="__CSS__/admin_common.css"/>
    <link rel="stylesheet" type="text/css" href="__CSS__/admin_main.css"/>
    <script type="text/javascript" src="__JS__/modernizr.min.js"></script>
    <script type="text/javascript" src="__JS__/jquery-1.8.0.min.js"></script>
</head>
<body>
<div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
        <div class="topbar-logo-wrap clearfix">
            <!-- <h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">后台管理</a></h1> -->
            <img style="height:50px;display:block;overflow:hidden;" src="__IMG__/logo_mall.jpg" alt="">
        </div>
        <div class="top-info-wrap">
            <ul class="top-info-list clearfix">
                <!-- <li><a href="#">管理员</a></li> -->
                <!-- <li><a href="#">修改密码</a></li> -->
                <li><a href="<?php echo U('Admin/Public/loginout');?>">退出</a></li>
            </ul>
        </div>
    </div>
</div>
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
        <div class="sidebar-content">
            <ul class="sidebar-list">
                <!--<li>
                    <a href="<?php echo U('Admin/Index/index');?>"><i class="icon-font">&#xe003;</i>常用操作</a>
                    <ul class="sub-menu">
                        <li><a href="<?php echo U('Admin/Adminuser/index');?>">用户管理</a></li>
                        <li><a href="<?php echo U('Admin/Express/index');?>">物流商户管理</a></li>
                        <li><a href="<?php echo U('Admin/Goods/index');?>">商品列表</a></li>

                    </ul>
                </li>
                <li>
                    <a href="<?php echo U('Admin/Prize/index');?>"><i class="icon-font">&#xe003;</i>配送管理</a>
                    <ul class="sub-menu">
                        <li><a href="<?php echo U('Admin/Prize/unsend');?>">未配送管理</a></li>
                        <li><a href="<?php echo U('Admin/Prize/hassend');?>">已配送管理</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="icon-font">&#xe003;</i>结算管理</a>
                    <ul class="sub-menu">
                        <li><a href="<?php echo U('Admin/Prize/LTbalance');?>">联通已结算订单</a></li>
                        <li><a href="<?php echo U('Admin/Prize/WLbalance');?>">物流已结算订单</a></li>
                    </ul>
                </li>-->
                <?php foreach($menu['main'] as $k1=>$v1){ echo '<li>'; echo '<a href="'.$v1[url].'"><i class="icon-font">&#xe003;</i>'.$v1[title].'</a>'; if($menu['sub'][$k1]){ echo '<ul class="sub-menu">'; foreach($menu['sub'][$k1] as $k2=>$v2){ echo '<li><a href="'.$v2[url].'">'.$v2[title].'</a></li>'; } echo '</ul>'; } echo '</li>'; } ?>
            </ul>
        </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">

    <div class="crumb-wrap">
        <!-- <div class="crumb-list"><i class="icon-font"></i><a href="index.html">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">作品管理</span></div> -->
    </div>
    <div class="search-wrap">
        <div class="search-content">
            <form action="" method="post">
                <table class="search-tab">
                    <tr>
                        <th width="120">商品级别:</th>
                        <td>
                            <?php echo frm_out_put($sortarr,'sort','option',$query['sort'],'','-请选择-');?>
                        </td>
                        <th width="70">分类:</th>
                        <td>
                            <?php echo frm_out_put($categray,'cate','option',$query['cate'],'','-请选择-');?>
                        </td>
                        <th width="70">每页显示:</th>
                        <td>
                            <?php $psize = array(5=>'5',20=>'20',50=>'50',100=>'100'); ?>
                            <?php echo frm_out_put($psize,'psize','option',$query['psize'],'');?>
                        </td>
                        <td><input class="btn btn-primary btn2" value="查询" type="submit"></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="result-wrap">
        
            <!-- <div class="result-title">
                <div class="result-list">
                    <a href="<?php echo U('Admin/Goods/set');?>"><i class="icon-font"></i>新增作品</a>

                    <a href="<?php echo U('Admin/Goods/export');?>" target="_blank"><i class="icon-font">&#xe005;</i>导出</a>

                </div>
            </div> -->
            <div class="result-content">
                <table class="result-tab" width="100%">
                    <tr>
                        <th class="tc1" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                        <!--<th>ID</th>-->
                        <th>姓名</th>
                        <th>联系电话</th>
                        <th>收货地址</th>
                        <th>兑奖号码</th>
                        <th>商品级别</th>
                        <th>分类</th>
                        <th>备注</th>
                        <th width="10%">提交时间</th>
                        <th>状态</th>
                        <th>单号</th>
                        <th>操作</th>
                    </tr>
                    <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                        <td class="tc"><input name="id[]" type="checkbox" value="<?php echo ($vo["id"]); ?>"></td>
                        <!--<td><?php echo ($vo["id"]); ?></td>-->
                        <td><?php echo ($vo["username"]); ?></td>
                        <td><?php echo ($vo["phone"]); ?></td>
                        <td><?php echo str_replace(' ','',$vo['area']) . $vo['address'] ?></td>
                        <td><?php echo ($vo["sncode"]); ?></td>
                        <td><?php echo ($sortarr[$vo['sort']]); ?></td>
                        <td><?php echo ($categray[$vo['categray']]); ?></td>
                        <td><?php echo ($vo["remark"]); ?></td>
                        <td><?php echo date('Y-m-d H:i:s',$vo['create_time']);?></td>
                        <?php if($vo['status'] > 0): ?><td><span class='blue'>已发放</span></td>
                            <td><?php echo ($vo["kdcode"]); ?></td>
                            <td></td>
                        <?php else: ?>
                            <td><span class='red'>未发放</span></td>
                            <td><input type="text" name="kdcode"/></td>
                            <td><a class="pointer" _href="<?php echo U('Admin/Prize/send');?>" data-id="<?php echo ($vo["id"]); ?>" onclick='sendGoods(this)'>配送</a></td><?php endif; ?>

                        <!--<td>
                            <?php if($vo['status']){ echo "<span class='blue'>已发放</span>"; }else{ echo "<span class='red'>未发放</span>"; } ?>
                        </td>
                        <td><input type="text"/></td>
                        <td>
                            <?php if($vo['status']){ echo "<a href='' onclick='sendGoods();return false'></a>"; }else{ echo "<a href='".U('Admin/Prize/send',array('id'=>$vo[id]))."' onclick='sendGoods(this)'>配送</a>"; } ?>
                        </td>-->
                        
                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                </table>
                <div class="list-page"> <?php echo ($page); ?></div>

                <?php if($isAdmin == true): ?><table class="result-tab" width="100%">
                        <tr><td width="10%">选择配送物流：</td><td><?php echo frm_out_put($express,'kdtype','radio');?><a class="btn btn-primary fr" onclick="selKD()">派发</a></td></tr>
                    </table><?php endif; ?>
            </div>

    </div>


</div>
<script type="text/javascript">
    function sendGoods(obj){
        var p = $(obj).parent().parent();
        var _href = $(obj).attr('_href'),
            id = $(obj).attr('data-id'),
            kdcode = p.find('input[name=kdcode]').val();
        if($.trim(kdcode)==''){
            alert('请填写快递单号');return;
        }
        $.post(_href,{id:id,kdcode:kdcode},function(data){
            if(data.status == 200){
                alert(data.msg);
                location.reload();
            }else{
                alert(data.msg);
            }
        },'json');
    }

    var selkd_url = "<?php echo U('Admin/Prize/selectKd');?>";
    function selKD(){
        var ids = [];
        var kdtype = $('input[name=kdtype]:checked').val();
        $('.tc').find('input[type=checkbox]').each(function(idx,e){
            if($(e).attr('checked')){
                ids.push($(e).val());
            }
        });
        if(ids.length == 0){
            alert('您尚未选择任务记录');
        }else{
            var ids_str = JSON.stringify(ids);
            $.post(selkd_url,{ids:ids_str,kdtype:kdtype},function(data){
                if(data.status==200){
                    alert(data.msg);
                    location.reload();
                }else{
                    alert(data.msg);
                }
            },'json');
        }
    }
</script>
    <!--/main-->
</div>
</body>
</html>
<script type="text/javascript" src="__JS__/main.js"></script>